package com.example.recipesapp.data

import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query

// 数据库操作接口
@Dao
interface RecipeDao {
    @Insert
    suspend fun insertRecipe(recipe: Recipe): Long

    @Insert
    suspend fun insertStep(step: Step)

    @Query("SELECT * FROM recipes WHERE name LIKE '%' || :keyword || '%'")
    suspend fun fuzzySearch(keyword: String): List<Recipe>

    @Query("SELECT * FROM steps WHERE recipeID = :recipeId ORDER BY stepNumber")
    suspend fun getSteps(recipeId: Long): List<Step>
}